home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / asm_msc1.arc / BOOT.ASM < prev    next >
Assembly Source File  |  1988-11-20  |  3KB  |  120 lines

  1. cseg    segment para public 'code'
  2. org    100h
  3.  
  4. ; This program is used to perform a reboot. The options are:
  5. ; /L - same as power-on, with full diagnostics
  6. ; /N or no option - same as Alt-Ctrl-Del
  7. ; /S - soft boot that preserves memory, except memory-resident programs. Some
  8. ; interrupt vectors are reset to their original value.
  9.  
  10. bdata    segment at 40h
  11. filler    db 72h dup(?)
  12. reset_flag dw ?
  13. bdata    ends
  14.  
  15. pwron    segment at 0ffffh
  16.     reset label far
  17. pwron    ends
  18.  
  19. boot    proc far
  20.     assume cs:cseg,ds:nothing,ss:nothing,es:nothing
  21.  
  22.     mov dx,offset copyr    ; print copyright
  23.     mov ah,9
  24.     int 21h
  25.  
  26.     mov si,80h        ; point to command line
  27.     mov ch,0
  28.     mov cl,[si]        ; get length
  29.     jcxz p040        ; no option - normal boot
  30.  
  31. p010:    inc si
  32.     mov al,[si]        ; get next character
  33.     cmp al,'/'              ; is it a slash?
  34.     jz p020         ; yes
  35.     loop p010        ; try the next one
  36.     jmp p040        ; give up - normal boot
  37.  
  38. p020:    mov al,[si+1]        ; get character after the slash
  39.     cmp al,'l'              ; long?
  40.     jz p050         ; yes
  41.     cmp al,'L'              ; long?
  42.     jz p050         ; yes
  43.     cmp al,'s'              ; short?
  44.     jz p070         ; yes
  45.     cmp al,'S'              ; short?
  46.     jz p070         ; yes
  47.                 ; must be normal
  48.  
  49. p040:    mov ax,1234h        ; normal boot
  50.     jmp p060
  51.  
  52. p050:    mov ax,0        ; long boot
  53.     mov al,0ch        ; turn off the drive
  54.     mov dx,03f2h
  55.     out dx,al
  56.  
  57.  
  58. p060:    assume es:bdata     ; normal & long boots
  59.     mov bx,bdata
  60.     mov es,bx
  61.     mov es:reset_flag,ax
  62.     jmp reset        ; jump to power-on entry point
  63.  
  64. p070:    assume es:nothing    ; short boot
  65.     mov ax,0
  66.     mov es,ax
  67.     mov bx,0f000h        ; bios code segment
  68.     cli            ; turn off interrupts
  69.  
  70. ;    mov di,13h*4        ; fix int 13h - disk i/o
  71. ;    mov ax,0ec59h
  72. ;    call p080
  73.  
  74.     mov di,9h*4        ; fix int 9h - keyboard
  75.     mov ax,0e987h
  76.     call p080
  77.  
  78.     mov di,16h*4        ; fix int 16h - keyboard i/o
  79.     mov ax,0e82eh
  80.     call p080
  81.  
  82.     mov di,41ah        ; fix keyboard buffer pointers
  83.     push bx
  84.     mov ax,1eh
  85.     mov bx,ax
  86.     call p080        ; set buffer head = tail
  87.     pop bx            ; get back segment
  88.  
  89.     mov di,10h*4        ; fix int 10h - video
  90.     mov ax,0f065h
  91.     call p080
  92.  
  93.     mov di,17h*4        ; fix int 17h - printer
  94.     mov ax,0efd2h
  95.     call p080
  96.  
  97.     mov di,1ch*4        ; fix int 1ch - timer
  98.     mov ax,0ff53h
  99.     call p080
  100.  
  101.     mov ax,0        ; clear user interrupts 60H - 67H
  102.     mov di,60h*4
  103.     mov cx,8*2        ; clear 8 interrupts
  104.     rep stosw
  105.  
  106.     sti            ; interrupts back on
  107.     int 19h         ; boot it
  108.  
  109. p080    proc near        ; restore interrupt vector
  110.     mov es:[di],ax
  111.     mov es:[di+2],bx
  112.     ret
  113. p080    endp
  114.  
  115. copyr    db 'BOOT - Copyright 1983 Data Base Decisions',10,13,'$'
  116.  
  117. boot    endp
  118. cseg    ends
  119. end    boot
  120.